﻿namespace EyeOpen.CsvParser.Windows
{
	using System.Data;

	public class DataTableParser
	{
		public DataTable GetTable(string csv, params string[] header)
		{
			var table = new DataTable();

			foreach (var column in header)
			{
				table.Columns.Add(column);
			}

			foreach (var line in csv.Split('\n'))
			{
				var dr = table.NewRow();
				dr.ItemArray = line.Split(',');
				table.Rows.Add(dr);
			}

			return table;
		}
	}
}